package cn.iocoder.yudao.module.promotion.gift.pojo.vo;

import cn.iocoder.yudao.framework.business.basic.pojo.vo.MemberScopeVO;
import cn.iocoder.yudao.framework.validation.InEnumValue;
import cn.iocoder.yudao.module.api.promotion.gift.dto.GiftActivityVO;
import cn.iocoder.yudao.module.api.promotion.gift.enums.GiftGiveType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;

@Schema(description = "赠品记录 Response VO")
@Data
public class GiftRecordVO extends MemberScopeVO {

    @Schema(description = "店铺编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long shopId;

    @Schema(description = "赠品活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long giftActivityId;

    @Schema(description = "赠品活动快照数据，JSON格式", requiredMode = Schema.RequiredMode.REQUIRED)
    @JsonIgnore
    private String giftActivitySnapshot;

    @Schema(description = "赠品活动信息", requiredMode = Schema.RequiredMode.REQUIRED)
    private GiftActivityVO giftActivity;

    @Schema(description = "赠品形式：0-线下产品、1-线上产品、2-优惠券", requiredMode = Schema.RequiredMode.REQUIRED)
    @InEnumValue(GiftGiveType.class)
    private Integer giftType;
    private String giftTypeName;

    @SuppressWarnings("unused")
    public String getGiftTypeName() {
        return GiftGiveType.valueOf(getGiftType()).getName();
    }

    @Schema(description = "产品 SPU 编号，赠品形式为线上产品时有效")
    private Long spuId;

    @Schema(description = "产品 SKU 编号，赠品形式为线上产品时有效")
    private Long skuId;

    @Schema(description = "优惠券模板编号，赠品形式为线上优惠券时有效")
    private Long couponTemplateId;

    @Schema(description = "业务类型：1-团购套餐、2-线下扫码、3-链动2+1", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer bizType;

    @Schema(description = "业务编号：团购订单编号、扫码订单编号、链动订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long bizId;

    @Schema(description = "状态：0-初始化、1-待领取、2-已领取、3-已过期、4-已转赠", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer status;

    @Schema(description = "来源交易单号")
    private String tradeNo;

    @Schema(description = "原价，单位为分，0表示免费", example = "0")
    private Integer originPrice;

    @Schema(description = "成本价。线下产品核销时暂时给用户看，用户可能需要线下协商支付给商家；线上产品兑换后需要分账给所属商家。", example = "0")
    private Integer costPrice;

    @Schema(description = "兑换时间")
    private LocalDateTime exchangeTime;

    @Schema(description = "转赠时间")
    private LocalDateTime transferTime;

    @Schema(description = "过期时间")
    private LocalDateTime expireTime;

}